package com.ruoyi.examine.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.examine.mapper.TbGradingRulesMapper;
import com.ruoyi.examine.domain.TbGradingRules;
import com.ruoyi.examine.service.ITbGradingRulesService;

/**
 * 评分细则Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-28
 */
@Service
public class TbGradingRulesServiceImpl implements ITbGradingRulesService
{
    @Autowired
    private TbGradingRulesMapper tbGradingRulesMapper;

    /**
     * 查询评分细则
     *
     * @param id 评分细则主键
     * @return 评分细则
     */
    @Override
    public TbGradingRules selectTbGradingRulesById(String id)
    {
        return tbGradingRulesMapper.selectTbGradingRulesById(id);
    }

    /**
     * 查询评分细则列表
     *
     * @param tbGradingRules 评分细则
     * @return 评分细则
     */
    @Override
    public List<TbGradingRules> selectTbGradingRulesList(TbGradingRules tbGradingRules)
    {
        return tbGradingRulesMapper.selectTbGradingRulesList(tbGradingRules);
    }

    /**
     * 新增评分细则
     *
     * @param tbGradingRules 评分细则
     * @return 结果
     */
    @Override
    public int insertTbGradingRules(TbGradingRules tbGradingRules)
    {
//        tbGradingRules.setCreateTime(DateUtils.getNowDate());
        tbGradingRules.setId(UUID.randomUUID().toString().replaceAll("-",""));
        return tbGradingRulesMapper.insertTbGradingRules(tbGradingRules);
    }

    /**
     * 修改评分细则
     *
     * @param tbGradingRules 评分细则
     * @return 结果
     */
    @Override
    public int updateTbGradingRules(TbGradingRules tbGradingRules)
    {
        tbGradingRules.setUpdateTime(DateUtils.getNowDate());
        return tbGradingRulesMapper.updateTbGradingRules(tbGradingRules);
    }

    /**
     * 批量删除评分细则
     *
     * @param ids 需要删除的评分细则主键
     * @return 结果
     */
    @Override
    public int deleteTbGradingRulesByIds(String[] ids)
    {
        return tbGradingRulesMapper.deleteTbGradingRulesByIds(ids);
    }

    /**
     * 删除评分细则信息
     *
     * @param id 评分细则主键
     * @return 结果
     */
    @Override
    public int deleteTbGradingRulesById(String id)
    {
        return tbGradingRulesMapper.deleteTbGradingRulesById(id);
    }
}
